<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
        <counter ref="one" @change="counterChange"></counter>
        <counter ref="two" @change="counterChange"></counter>
        <div>{{total}}</div>
    </div>
    <script>
        Vue.component("counter", {
            data: function(){
              return {
                  number: 0
              }
            },
            template: "<div @click='counterClick'>{{number}}</div>",
            methods: {
                counterClick: function () {
                    this.number ++;
                    this.$emit("change");
                }
            }
        })
        var vm = new Vue({
            el:"#app",
            data: {
                total: 0
            },
            methods: {
                counterChange: function () {
                    this.total = this.$refs.one.number + this.$refs.two.number;
                }
            }
        })
    </script>
</body>
</html>